/**
 * 公共方法
 */
export default {
  session: {
    set: function (n, v) {
      let val = JSON.stringify(v)
      window.sessionStorage.setItem(n, val)
    },
    // 获取本地存储
    get: function (name) {
      return JSON.parse(window.sessionStorage.getItem(name))
    },
    // 本地存储清除
    remove: function (name) {
      window.sessionStorage.removeItem(name)
    },
    // 清空本地存储
    clear: function () {
      window.sessionStorage.clear()
    }
  },
  localSession: {
    set: function (n, v) {
      window.localStorage.setItem(n, v)
    },
    get: function (name) {
      return window.localStorage.getItem(name)
    }
  }
}
